package top.kuxiao.crmserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import top.kuxiao.crmserver.pojo.Orders;
import top.kuxiao.crmserver.mapper.OrdersMapper;
import top.kuxiao.crmserver.service.IOrdersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 订单管理 服务实现类
 * </p>
 *
 * @author xiaozhang
 * @since 2022-01-18
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements IOrdersService {

    @Autowired
    OrdersMapper ordersMapper;

    // 2. 查询一页的内容
    @Override
    public IPage<Orders> queryByPage(int current, int rows,Integer id) {
        // 第几页， 查多少行
        Page<Orders> page = new Page<>(current, rows);


        QueryWrapper<Orders> ordersQueryWrapper = new QueryWrapper<>();
        ordersQueryWrapper.eq("customer_id",id);

        // 调用分页的接口方法

        return ordersMapper.selectPage(page,ordersQueryWrapper);
    }
}
